<template>
<div id="">
    <!-- toRefs方法:用toRefs来解构，解构出来的对象也是响应式的。 -->
    <p>{{name}}</p>
    <p>{{age}}</p>
    <button @click="hdClick">toRefs按钮</button>
</div>
</template>

<script>
import {
    reactive,toRefs
} from "vue"
export default {
    setup() {
        let obj = {
            name: 'Vue',
            age: 3
        }
        obj = reactive(obj);
        let hdClick = () => {
            obj.age++;
        }

        return {
            ...toRefs(obj),
            hdClick,
        }
    }
}
</script>

<style lang="less" scoped>
</style>
